package com.natalia.file.config;


import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @Author yang
 **/
@EnableOpenApi
@EnableKnife4j
@Configuration
public class SwaggerConfig {

    /**
     * 接口构建器
     *
     * @return
     */
    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.OAS_30)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.natalia.file.controller"))
                .paths(PathSelectors.any())
                .build()
                .groupName("natalia-file")
                .enable(true);
    }

    /**
     * Api页面信息配置
     *
     * @return
     */
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("文件服务接口文档")
                .description("文件服务API")
                .contact(new Contact("natalia", "https://gitee.com/ylj2020/natalia-file", "846796446@qq.com"))
                .version("V1.0")
                .build();
    }



}
